package com.controller;


import com.Service.PortfolioService;

import com.model.pojo.Portfolio;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import com.model.pojo.Package;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;


@Controller
@RequestMapping("/portfolio")
public class PortfolioController{

    @Resource
    private PortfolioService portfolioService;


    /*
     *开单操作1：组合项目清单显示
     */
    @RequestMapping("/find")
    public String findPortfolio(Portfolio portfolio, Model model){
        List<Portfolio> portfolios = portfolioService.findPortfolioList(portfolio);
        //查询所有的套餐 搜索条件为空
        List<Package> packages = portfolioService.findPackageList(null);
        model.addAttribute("portfolios",portfolios);
        model.addAttribute("packages",packages);
        System.out.println("11111111111");
        return "billinglist1";
    }




//    查询套餐下所有的项目编号

@RequestMapping("/findByPid{pid}")
@ResponseBody
    public List<Integer> findByPid(@PathVariable Integer pid){
        System.out.println(pid);

        return portfolioService.findIdByPackage(pid);
    }

}
